package com.yuanfeng.business.feign;

import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.user.UserInfoVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.util.Map;

/**
 * @FeignClient 指明我们要从注册中心中发现的服务的名称
 */
@FeignClient(name = "mall-userms", url = "http://localhost:8081")
public interface UsermsServiceClient {
    /*
     * 查看商品收藏与否
     */
    @PostMapping("user/favoritesGoods/check")
    ResponseResult checkGoodsFavoriteOrNot(@RequestBody Map<String, String> paraMap);

    /*
     * 查看店铺收藏与否
     */
    @PostMapping("user/favoritesShop/check")
    ResponseResult checkFavoriteShopOrNot(@RequestBody Map<String, String> paraMap);

    /**
     * 判断是否企业用户
     *
     * @param userId
     * @return
     */
    @PostMapping("/user/businessInfo/isBusiness/fegin")
    boolean isBusinessFegin(@RequestParam("userId") String userId);


    /**
     * 登录名动态校验
     * @param map
     * @return
     */
    @PostMapping("/user/ms/checkPhone")
    ResponseResult checkPhone(@RequestBody Map<String, Object> map);

    /**
     * 用户注册
     *
     * @param map
     * @return
     */
    @PostMapping("/user/ms/register")
    ResponseResult register(@RequestBody Map<String, String> map) throws IOException;

    /**
     * fegin平台-查找管理员
     *
     * @param userId
     * @return
     */
    @GetMapping("/platform/userinfo/getDistrictChildIds")
    ResponseResult getDistrictChildIds(@RequestParam("userId") String userId);


    /**
     * 删除收藏的店铺
     *
     * @param shopId
     * @return 删除结果
     */
    @PostMapping("/user/favoritesShop/delByShopId")
    ResponseResult delFavoritesByShopId(@RequestParam("shopId") Integer shopId);

    /**
     * 根据userId更改是否商家状态
     *
     * @param userId
     * @param shopId
     * @param isShop
     * @return
     */
    @GetMapping("/user/ms/updateUserIsShop")
    ResponseResult updateUserIsShop(@RequestParam("userId") String userId, @RequestParam("shopId") Integer shopId,
                                    @RequestParam("isShop") Integer isShop);


    /**
     * 根据参数查用户信息
     *
     * @return
     */
    @PostMapping("/user/ms/queryUserInfo")
    ResponseResult queryUserInfo(@RequestBody UserInfoVO userInfoVO);

    /**
     * 根据参数查用户信息
     *
     * @return
     */
    @PostMapping("/user/ms/queryUserVO")
    ResponseResult queryUserInfoByUserInfoVO(@RequestBody Map<String, String> userInfoVO);

    /**
     * 添加企业信息
     *
     * @param map
     * @return
     */
    @PostMapping("/user/businessInfo/register/insertBusiness")
    ResponseResult insertBusiness(@RequestBody Map<String, String> map);

    /**
     * 更新企业信息
     *
     * @param map
     * @return
     */
    @PostMapping("/user/businessInfo/update/businessInfo")
    ResponseResult updateBusinessInfo(@RequestBody Map<String, String> map);


    /**
     * 添加商家信息
     *
     * @param paraMap
     * @return
     */
    @PostMapping("/user/ms/addseller")
    ResponseResult addSeller(@RequestBody Map<String, Object> paraMap);


}
